﻿using System;
namespace Colors.Xroad.Eu {
    
    
    [System.SerializableAttribute()]
    public class Color : global::Xtee.Core.Types.ListTypeBase<Color.Int16Type> {
        
        public Color(string value) : 
                base(value) {
            this.PikkusVordne = 3;
            this.Validate();
        }
        
        public Color() : 
                base(new System.Collections.Generic.List<Int16Type>()) {
        }
        
        public Color(System.Collections.Generic.IList<Int16Type> value) : 
                base(value) {
            this.PikkusVordne = 3;
            this.Validate();
        }
        
        public static bool TryParse(string value, out global::Colors.Xroad.Eu.Color result) {
            try {
                result = new global::Colors.Xroad.Eu.Color(value);
                return true;
            }
            catch (System.Exception ) {
                result = null;
                return false;
            }
        }
        
        public static global::Colors.Xroad.Eu.Color Parse(string value) {
            global::Colors.Xroad.Eu.Color _Color = null;
            if (global::Colors.Xroad.Eu.Color.TryParse(value,out _Color)) {
                return new Color(_Color);
            }
             throw new FormatException("Cannot parse to type [global::Colors.Xroad.Eu.Color] from string value : [" + value + "]");;
        }
        
        public override Int16Type ParseElement(string value) {
            return new Int16Type(value);
        }
        
        [System.SerializableAttribute()]
        public class Int16Type : global::Xtee.Core.Schema.XsdShort {
            
            public Int16Type(short value) : 
                    base(value) {
                this.SuuremVordneKui = (System.Int16)0;
                this.VaiksemVordneKui = (System.Int16)255;
                this.Validate();
            }
            
            public Int16Type(string value) : 
                    base(value) {
                this.SuuremVordneKui = (System.Int16)0;
                this.VaiksemVordneKui = (System.Int16)255;
                this.Validate();
            }
            
            public Int16Type() : 
                    base(new short()) {
            }
            
            public static bool TryParse(string value, out Int16Type result) {
                try {
                    result = new Int16Type(value);
                    return true;
                }
                catch (System.Exception ) {
                    result = null;
                    return false;
                }
            }
            
            public static implicit operator Int16 (Int16Type value) {
                return value.Value;
            }
            
            public static implicit operator Int16Type (short value) {
                return new Int16Type(value);
            }
        }
    }
}
